package com.xjob.exception;

import lombok.extern.slf4j.Slf4j;

import java.io.Serializable;

/**
 * @Author: xianggaoxiong
 * @Date: 2020-09-29 15:37
 **/
@Slf4j
public class ServiceException extends RuntimeException implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 异常对应的返回码
     */
    private Integer errorCode;
    /**
     * 异常对应的返回信息
     */
    private String errorMessage;

    public Integer getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public ServiceException(String errorMessage) {
        super(errorMessage);
        this.errorCode = 500;
        this.errorMessage = errorMessage;
    }

    public ServiceException(String errorMessage, Integer errorCode) {
        super(errorMessage);
        this.errorMessage = errorMessage;
        this.errorCode = errorCode;
    }

    public ServiceException(String errorMessage, Throwable cause) {
        super(errorMessage, cause);
    }

    public ServiceException(Throwable cause) {
        super(cause);
    }

}

